<%@ page language="java"
	import="java.util.*,bc.swim2.ejb.entity.Ability"
	contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Admin Home</title>
<style>
@import url(css/main.css);
</style>
</head>
<body>
	<div id="allContainer">
		<h1 id="pageTitle">Admin Home</h1>
		<div id="singleContainer">
			<a href="LoginServlet?methodName=logout" id="linkRef">Logout</a>
		</div>
		<h1 id="normalTitle">
			<a href="MainServlet?to=ShowAbilityRequests">Show</a> ability
			requests.
		</h1>

		<h1 id="normalTitle">You can insert a new ability:</h1>
		<%
			if (request.getAttribute("abilityAlreadyExists") != null) {
		%>

		<h1 id="failed">This ability already exists!</h1>

		<%
			}
		%>
		<div id="singleContainer">
			<form action="AbilityServlet" method="post">

				<label id="loginLabel">New ability name: </label><input type="text"
					id="textInput" name="name" /> <input type="hidden"
					name="methodName" value="add" />
				<div align="center">
					<input type="submit" id="submitInputA" name="submit"
						value="Add Ability" />
				</div>
			</form>
		</div>
		<p>
			<br> <br>
		</p>
		<div id="singleContainer">
			<h1 id="normalTitle">Complete ability list:</h1>
			<%
				List<Ability> abilities = null;
				abilities = (List<Ability>) request.getAttribute("allAbilityList");
			%><table>
				<%
					for (Ability a : abilities) {
						String abilityName = a.getName();
				%>
				<tr>
					<td><label id="abilityListElement"><%=abilityName%></label></td>
					<td>
						<form action=AbilityServlet method="POST">
							<input type="hidden" name="abilityId" value=<%=a.getId()%>>
							<input type="hidden" name="methodName" value="remove"> <input
								type="submit" id="submitInputA" value="Remove">
						</form>
					</td>
				</tr>
				<%
					}
				%>
			</table>
		</div>
	</div>
</body>
</html>